package com.mystore.author.security.utils;

import com.mystore.framework.pojo.Role;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 返回某个能访问Uri的全部Role
 */
public class UrlUtils {
    public static List<Role> getRoleList(String urlId,List<Role> roles){
        return roles.stream().filter(role -> Arrays.asList(role.getRights().split(",")).contains(urlId)).collect(Collectors.toList());
    }
}
